package com.antdesignbackend.backend.controller;

import com.antdesignbackend.backend.animalNumber.entity.AnimalNumber;
import com.antdesignbackend.backend.animalNumber.service.AnimalNumberService;
import com.antdesignbackend.backend.aop.AuthToken;
import com.antdesignbackend.backend.common.returnResult.ReturnVO;
import com.antdesignbackend.backend.common.web.BaseController;
import com.antdesignbackend.backend.district.entity.District;
import com.antdesignbackend.backend.district.service.DistrictService;
import com.antdesignbackend.backend.entity.*;
import com.antdesignbackend.backend.form.saleDeclarationA.entity.SaleDeclarationA;
import com.antdesignbackend.backend.form.saleDeclarationA.service.SaleDeclarationAService;
import com.antdesignbackend.backend.form.saleDeclarationB.entity.SaleDeclarationB;
import com.antdesignbackend.backend.form.saleDeclarationB.service.SaleDeclarationBService;
import com.antdesignbackend.backend.service.EnterpriseService;
import com.antdesignbackend.backend.service.HarmlessReportService;
import com.antdesignbackend.backend.town.entity.Town;
import com.antdesignbackend.backend.town.service.TownService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import java.lang.reflect.InvocationTargetException;
import java.text.SimpleDateFormat;
import java.util.*;

@Controller
@RequestMapping("/stat")
public class StatisticsController extends BaseController {

    @Autowired
    private EnterpriseService enterpriseService;

    @Autowired
    private SaleDeclarationAService  saleDeclarationAService;
    @Autowired
    private SaleDeclarationBService saleDeclarationBService;
    @Autowired
    private HarmlessReportService harmlessReportService;
    @Autowired
    private DistrictService districtService;
    @Autowired
    private TownService townService;
    @Autowired
    private AnimalNumberService animalNumberService;
    @GetMapping("/index")
    @AuthToken
    public String Index(Model model) {
        SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd");
        String endDate=simpleDateFormat.format(new Date());
        model.addAttribute("endDate",endDate);
        return "statistics/index";
    }
    //查询企业分布情况
    @PostMapping("/findEnterprise")
    @ResponseBody
    @AuthToken
    public ReturnVO findEnterprise(@RequestBody() FindUtil findUtil) throws NoSuchMethodException, SecurityException,
            IllegalAccessException, IllegalArgumentException, InvocationTargetException {
        System.out.println("YYYYYYYYYY"+findUtil+","+findUtil.getCityCode()+","+findUtil.getDistrictCode()+","+findUtil.getTownCode());
        ReturnVO returnVO=new ReturnVO();
        List<FindEnterpriseUtil> findEnterpriseUtils=new ArrayList<>();
        int sum=0;
        if(findUtil.getDistrictCode()!=null && findUtil.getDistrictCode().equals("")){
            QueryWrapper<District> disinfectQueryWrapper=new QueryWrapper<>();
            disinfectQueryWrapper.eq("city_id",findUtil.getCityCode());
            List<District> districts=districtService.list(disinfectQueryWrapper);
            for(District district:districts){
                QueryWrapper<Enterprise> enterpriseQueryWrapper=new QueryWrapper<>();
                enterpriseQueryWrapper.eq("districtCode",district.getDistrict_id());
                sum=enterpriseService.count(enterpriseQueryWrapper);
                if(sum!=0){
                    FindEnterpriseUtil findEnterpriseUtil=new FindEnterpriseUtil();
                    findEnterpriseUtil.setAddress(district.getDistrict_name());
                    findEnterpriseUtil.setNumber(sum);
                    findEnterpriseUtils.add(findEnterpriseUtil);
                }
            }

        } else if(findUtil.getTownCode()!=null && findUtil.getTownCode().equals("")){
            QueryWrapper<Town> townQueryWrapper=new QueryWrapper<>();
            townQueryWrapper.eq("district_id",findUtil.getDistrictCode());
            List<Town> towns=townService.list(townQueryWrapper);
            for(Town town:towns){
                QueryWrapper<Enterprise> enterpriseQueryWrapper=new QueryWrapper<>();
                enterpriseQueryWrapper.eq("townCode",town.getTown_id());
                sum=enterpriseService.count(enterpriseQueryWrapper);
                if(sum!=0){
                    FindEnterpriseUtil findEnterpriseUtil=new FindEnterpriseUtil();
                    findEnterpriseUtil.setAddress(town.getTown__name());
                    findEnterpriseUtil.setNumber(sum);
                    findEnterpriseUtils.add(findEnterpriseUtil);
                }
            }
        }else{
            QueryWrapper<Town> townQueryWrapper=new QueryWrapper<>();
            townQueryWrapper.eq("town_id",findUtil.getTownCode());
            List<Town> towns=townService.list(townQueryWrapper);
            for(Town town:towns){
                QueryWrapper<Enterprise> enterpriseQueryWrapper=new QueryWrapper<>();
                enterpriseQueryWrapper.eq("townCode",town.getTown_id());
                sum=enterpriseService.count(enterpriseQueryWrapper);
                if(sum!=0){
                    FindEnterpriseUtil findEnterpriseUtil=new FindEnterpriseUtil();
                    findEnterpriseUtil.setAddress(town.getTown__name());
                    findEnterpriseUtil.setNumber(sum);
                    findEnterpriseUtils.add(findEnterpriseUtil);
                }
            }
        }
        List<FindEnterpriseUtil> o=page1(findEnterpriseUtils,findUtil.getPageSize(),findUtil.getPageIndex());
        returnVO.setData(o);
        returnVO.setTotal(findEnterpriseUtils.size());
        return returnVO;
    }

    //查询企业分布情况明细
    @PostMapping("/findEnterprise2")
    @ResponseBody
    @AuthToken
    public ReturnVO findEnterprise2(@RequestBody() FindUtil findUtil) throws NoSuchMethodException, SecurityException,
            IllegalAccessException, IllegalArgumentException, InvocationTargetException {
        ReturnVO returnVO=new ReturnVO();
        List<FindEnterpriseUtil> findEnterpriseUtils=new ArrayList<>();
        QueryWrapper<Enterprise> enterpriseQueryWrapper=new QueryWrapper<>();
        int pigSum=0,cattleSum=0,sheepSum=0,otherSum=0;
        if(findUtil.getCityCode()!=null &&!findUtil.getCityCode().equals("")){
            enterpriseQueryWrapper.eq("cityCode",findUtil.getCityCode());
        }
        if(findUtil.getDistrictCode()!=null && !findUtil.getDistrictCode().equals("")){
            enterpriseQueryWrapper.eq("districtCode",findUtil.getDistrictCode());
        }
        if(findUtil.getTownCode()!=null && !findUtil.getTownCode().equals("")){
            enterpriseQueryWrapper.eq("townCode",findUtil.getTownCode());
        }
        enterpriseQueryWrapper.eq("animalTypes",1).eq("examine",1);
        List<Enterprise> enterprises=enterpriseService.list(enterpriseQueryWrapper);
        for(Enterprise enterprise:enterprises){
            FindEnterpriseUtil findEnterpriseUtil=new FindEnterpriseUtil();
            findEnterpriseUtil.setEnterpriseName(enterprise.getEnterpriseName());
            findEnterpriseUtil.setLegalPerson(enterprise.getUserName());
            findEnterpriseUtil.setPhone(enterprise.getPhone());
            findEnterpriseUtil.setEnterpriseName(enterprise.getEnterpriseName());
            findEnterpriseUtil.setAnimal(enterprise.getAnimal());
            findEnterpriseUtil.setEnterpriseName(enterprise.getEnterpriseName());
            findEnterpriseUtil.setPullAddress(enterprise.getFullAddress());
            findEnterpriseUtil.setEnterpriseName(enterprise.getEnterpriseName());
            findEnterpriseUtil.setCreateTime(enterprise.getCreateTime());
            findEnterpriseUtils.add(findEnterpriseUtil);
        }
        List<FindEnterpriseUtil> o=page1(findEnterpriseUtils,findUtil.getPageSize(),findUtil.getPageIndex());
        returnVO.setData(o);
        returnVO.setTotal(findEnterpriseUtils.size());

        return returnVO;
    }
    //查询饲养牲畜存栏数情况(总)
    @PostMapping("/findLivestock")
    @ResponseBody
    @AuthToken
    public ReturnVO findLivestock(@RequestBody() FindUtil findUtil) throws NoSuchMethodException, SecurityException,
            IllegalAccessException, IllegalArgumentException, InvocationTargetException {
        ReturnVO returnVO=new ReturnVO();
        List<FindLivestockUtil> findLivestockUtils=new ArrayList<>();
        QueryWrapper<Enterprise> enterpriseQueryWrapper=new QueryWrapper<>();
        int pigSum=0,cattleSum=0,sheepSum=0,otherSum=0;
        if(findUtil.getCityCode()!=null &&!findUtil.getCityCode().equals("")){
            enterpriseQueryWrapper.eq("cityCode",findUtil.getCityCode());
        }
        if(findUtil.getDistrictCode()!=null && !findUtil.getDistrictCode().equals("")){
            enterpriseQueryWrapper.eq("districtCode",findUtil.getDistrictCode());
        }
        if(findUtil.getTownCode()!=null && !findUtil.getTownCode().equals("")){
            enterpriseQueryWrapper.eq("townCode",findUtil.getTownCode());
        }
        enterpriseQueryWrapper.eq("animalTypes",1).eq("examine",1);
        List<Enterprise> enterprises=enterpriseService.list(enterpriseQueryWrapper);
        for(Enterprise enterprise:enterprises){
            QueryWrapper<AnimalNumber> animalNumberQueryWrapper=new QueryWrapper<>();
            animalNumberQueryWrapper.eq("eid",enterprise.getEnterpriseId());
            List<AnimalNumber> animalNumbers=animalNumberService.list(animalNumberQueryWrapper);
            System.out.println("查询到的动物明细有"+animalNumbers);
            for(AnimalNumber animalNumber:animalNumbers){
                if(enterprise.getAnimal().equals("猪")){
                    pigSum=pigSum+animalNumber.getSpecies()+animalNumber.getReserve()+animalNumber.getMenstruation()+animalNumber.getLactation()+animalNumber.getConservation()+animalNumber.getCommodity();
                }else if(enterprise.getAnimal().equals("牛")){
                    cattleSum=cattleSum+animalNumber.getSpecies()+animalNumber.getReserve()+animalNumber.getMenstruation()+animalNumber.getLactation()+animalNumber.getConservation()+animalNumber.getCommodity();
                }else if(enterprise.getAnimal().equals("羊")){
                    sheepSum=sheepSum+animalNumber.getSpecies()+animalNumber.getReserve()+animalNumber.getMenstruation()+animalNumber.getLactation()+animalNumber.getConservation()+animalNumber.getCommodity();
                }else{
                    otherSum=otherSum+animalNumber.getSpecies()+animalNumber.getReserve()+animalNumber.getMenstruation()+animalNumber.getLactation()+animalNumber.getConservation()+animalNumber.getCommodity();
                }
            }
        }
        FindLivestockUtil findLivestockUtil=new FindLivestockUtil();
        findLivestockUtil.setPigNumber(pigSum);
        findLivestockUtil.setCattleNumber(cattleSum);
        findLivestockUtil.setSheepNumber(sheepSum);
        findLivestockUtil.setOtherNumber(otherSum);
        findLivestockUtils.add(findLivestockUtil);

        List<FindLivestockUtil> o=page2(findLivestockUtils,findUtil.getPageSize(),findUtil.getPageIndex());
        returnVO.setData(o);
        returnVO.setTotal(findLivestockUtils.size());

        return returnVO;
    }
    //查询饲养牲畜存栏数情况(分)
    @PostMapping("/findLivestock2")
    @ResponseBody
    @AuthToken
    public ReturnVO findLivestock2(@RequestBody() FindUtil findUtil) throws NoSuchMethodException, SecurityException,
            IllegalAccessException, IllegalArgumentException, InvocationTargetException {
        ReturnVO returnVO=new ReturnVO();
        List<FindLivestockUtil> findLivestockUtils=new ArrayList<>();
        QueryWrapper<Enterprise> enterpriseQueryWrapper=new QueryWrapper<>();
        if(findUtil.getCityCode()!=null &&!findUtil.getCityCode().equals("")){
            enterpriseQueryWrapper.eq("cityCode",findUtil.getCityCode());
        }
        if(findUtil.getDistrictCode()!=null && !findUtil.getDistrictCode().equals("")){
            enterpriseQueryWrapper.eq("districtCode",findUtil.getDistrictCode());
        }
        if(findUtil.getTownCode()!=null && !findUtil.getTownCode().equals("")){
            enterpriseQueryWrapper.eq("townCode",findUtil.getTownCode());
        }
        enterpriseQueryWrapper.eq("animalTypes",1).eq("examine",1);
        List<Enterprise> enterprises=enterpriseService.list(enterpriseQueryWrapper);
        for(Enterprise enterprise:enterprises){
            QueryWrapper<AnimalNumber> animalNumberQueryWrapper=new QueryWrapper<>();
            animalNumberQueryWrapper.eq("eid",enterprise.getEnterpriseId());
            List<AnimalNumber> animalNumbers=animalNumberService.list(animalNumberQueryWrapper);
            System.out.println("查询到的动物明细有"+animalNumbers);
            int pigSum=0,cattleSum=0,sheepSum=0,otherSum=0;
            for(AnimalNumber animalNumber:animalNumbers){
                if(enterprise.getAnimal().equals("猪")){
                    pigSum=pigSum+animalNumber.getSpecies()+animalNumber.getReserve()+animalNumber.getMenstruation()+animalNumber.getLactation()+animalNumber.getConservation()+animalNumber.getCommodity();
                }else if(enterprise.getAnimal().equals("牛")){
                    cattleSum=cattleSum+animalNumber.getSpecies()+animalNumber.getReserve()+animalNumber.getMenstruation()+animalNumber.getLactation()+animalNumber.getConservation()+animalNumber.getCommodity();
                }else if(enterprise.getAnimal().equals("羊")){
                    sheepSum=sheepSum+animalNumber.getSpecies()+animalNumber.getReserve()+animalNumber.getMenstruation()+animalNumber.getLactation()+animalNumber.getConservation()+animalNumber.getCommodity();
                }else{
                    otherSum=otherSum+animalNumber.getSpecies()+animalNumber.getReserve()+animalNumber.getMenstruation()+animalNumber.getLactation()+animalNumber.getConservation()+animalNumber.getCommodity();
                }
            }
            FindLivestockUtil findLivestockUtil=new FindLivestockUtil();
            findLivestockUtil.seteName(enterprise.getEnterpriseName());
            findLivestockUtil.setPigNumber(pigSum);
            findLivestockUtil.setCattleNumber(cattleSum);
            findLivestockUtil.setSheepNumber(sheepSum);
            findLivestockUtil.setOtherNumber(otherSum);
            findLivestockUtils.add(findLivestockUtil);
        }
        List<FindLivestockUtil> o=page2(findLivestockUtils,findUtil.getPageSize(),findUtil.getPageIndex());
        returnVO.setData(o);
        returnVO.setTotal(findLivestockUtils.size());
        return returnVO;
    }
    //查询饲养家禽存栏数情况(总)
    @PostMapping("/findPoultry")
    @ResponseBody
    @AuthToken
    public ReturnVO findPoultry(@RequestBody() FindUtil findUtil) throws NoSuchMethodException, SecurityException,
            IllegalAccessException, IllegalArgumentException, InvocationTargetException {
        ReturnVO returnVO=new ReturnVO();
        List<FindPoultryUtil> findPoultryUtils=new ArrayList<>();
        QueryWrapper<Enterprise> enterpriseQueryWrapper=new QueryWrapper<>();
        int meatChickenSum=0,meatDuckSum=0,eggChickenSum=0,eggDuckSum=0,otherSum=0;
        if(findUtil.getCityCode()!=null &&!findUtil.getCityCode().equals("")){
            enterpriseQueryWrapper.eq("cityCode",findUtil.getCityCode());
        }
        if(findUtil.getDistrictCode()!=null && !findUtil.getDistrictCode().equals("")){
            enterpriseQueryWrapper.eq("districtCode",findUtil.getDistrictCode());
        }
        if(findUtil.getTownCode()!=null && !findUtil.getTownCode().equals("")){
            enterpriseQueryWrapper.eq("townCode",findUtil.getTownCode());
        }
        enterpriseQueryWrapper.eq("animalTypes",0).eq("examine",1);
        List<Enterprise> enterprises=enterpriseService.list(enterpriseQueryWrapper);
        for(Enterprise enterprise:enterprises){
            System.out.println("查询到的企业名有"+enterprise.getEnterpriseName()+"动物为"+enterprise.getAnimal());
            QueryWrapper<AnimalNumber> animalNumberQueryWrapper=new QueryWrapper<>();
            animalNumberQueryWrapper.eq("eid",enterprise.getEnterpriseId());
            List<AnimalNumber> animalNumbers=animalNumberService.list(animalNumberQueryWrapper);
            System.out.println("查询到的动物明细有"+animalNumbers);
            for(AnimalNumber animalNumber:animalNumbers){
                if(enterprise.getAnimal().equals("肉鸡")){
                    meatChickenSum=meatChickenSum+animalNumber.getLivestock();
                }else if(enterprise.getAnimal().equals("肉鸭")){
                    meatDuckSum=meatDuckSum+animalNumber.getLivestock();
                }else if(enterprise.getAnimal().equals("蛋鸡")){
                    eggChickenSum=eggChickenSum+animalNumber.getLivestock();
                }else if(enterprise.getAnimal().equals("蛋鸭")){
                    eggDuckSum=eggDuckSum+animalNumber.getLivestock();
                }else{
                    otherSum=otherSum+animalNumber.getLivestock();
                }
            }
        }
        FindPoultryUtil findPoultryUtil=new FindPoultryUtil();
        findPoultryUtil.setMeatChickenNumber(meatChickenSum);
        findPoultryUtil.setMeatDuckNumber(meatDuckSum);
        findPoultryUtil.setEggChickenNumber(eggChickenSum);
        findPoultryUtil.setEggDuckNumber(eggDuckSum);
        findPoultryUtil.setOtherNumber(otherSum);
        findPoultryUtils.add(findPoultryUtil);

        List<FindPoultryUtil> o=page3(findPoultryUtils,findUtil.getPageSize(),findUtil.getPageIndex());
        returnVO.setData(o);
        returnVO.setTotal(findPoultryUtils.size());

        return returnVO;
    }
    //查询饲养家禽存栏数情况(分)
    @PostMapping("/findPoultry2")
    @ResponseBody
    @AuthToken
    public ReturnVO findPoultry2(@RequestBody() FindUtil findUtil) throws NoSuchMethodException, SecurityException,
            IllegalAccessException, IllegalArgumentException, InvocationTargetException {
        ReturnVO returnVO=new ReturnVO();
        List<FindPoultryUtil> findPoultryUtils=new ArrayList<>();
        QueryWrapper<Enterprise> enterpriseQueryWrapper=new QueryWrapper<>();
        if(findUtil.getCityCode()!=null &&!findUtil.getCityCode().equals("")){
            enterpriseQueryWrapper.eq("cityCode",findUtil.getCityCode());
        }
        if(findUtil.getDistrictCode()!=null && !findUtil.getDistrictCode().equals("")){
            enterpriseQueryWrapper.eq("districtCode",findUtil.getDistrictCode());
        }
        if(findUtil.getTownCode()!=null && !findUtil.getTownCode().equals("")){
            enterpriseQueryWrapper.eq("townCode",findUtil.getTownCode());
        }
        enterpriseQueryWrapper.eq("animalTypes",0).eq("examine",1);
        List<Enterprise> enterprises=enterpriseService.list(enterpriseQueryWrapper);
        for(Enterprise enterprise:enterprises){
            System.out.println("查询到的企业名有"+enterprise.getEnterpriseName()+"动物为"+enterprise.getAnimal());
            QueryWrapper<AnimalNumber> animalNumberQueryWrapper=new QueryWrapper<>();
            animalNumberQueryWrapper.eq("eid",enterprise.getEnterpriseId());
            List<AnimalNumber> animalNumbers=animalNumberService.list(animalNumberQueryWrapper);
            System.out.println("查询到的动物明细有"+animalNumbers);
            int meatChickenSum=0,meatDuckSum=0,eggChickenSum=0,eggDuckSum=0,otherSum=0;
            for(AnimalNumber animalNumber:animalNumbers){
                if(enterprise.getAnimal().equals("肉鸡")){
                    meatChickenSum=meatChickenSum+animalNumber.getLivestock();
                }else if(enterprise.getAnimal().equals("肉鸭")){
                    meatDuckSum=meatDuckSum+animalNumber.getLivestock();
                }else if(enterprise.getAnimal().equals("蛋鸡")){
                    eggChickenSum=eggChickenSum+animalNumber.getLivestock();
                }else if(enterprise.getAnimal().equals("蛋鸭")){
                    eggDuckSum=eggDuckSum+animalNumber.getLivestock();
                }else{
                    otherSum=otherSum+animalNumber.getLivestock();
                }
            }
            FindPoultryUtil findPoultryUtil=new FindPoultryUtil();
            findPoultryUtil.seteName(enterprise.getEnterpriseName());
            findPoultryUtil.setMeatChickenNumber(meatChickenSum);
            findPoultryUtil.setMeatDuckNumber(meatDuckSum);
            findPoultryUtil.setEggChickenNumber(eggChickenSum);
            findPoultryUtil.setEggDuckNumber(eggDuckSum);
            findPoultryUtil.setOtherNumber(otherSum);
            findPoultryUtils.add(findPoultryUtil);
        }


        List<FindPoultryUtil> o=page3(findPoultryUtils,findUtil.getPageSize(),findUtil.getPageIndex());
        returnVO.setData(o);
        returnVO.setTotal(findPoultryUtils.size());

        return returnVO;
    }

    //查询检疫情况(总)
    @PostMapping("/findQuarantine")
    @ResponseBody
    @AuthToken
    public ReturnVO findQuarantine(@RequestBody() FindUtil findUtil) throws NoSuchMethodException, SecurityException,
            IllegalAccessException, IllegalArgumentException, InvocationTargetException {
        ReturnVO returnVO=new ReturnVO();
        List<FindQuarantineUtil> findQuarantineUtils=new ArrayList<>();
        QueryWrapper<Enterprise> enterpriseQueryWrapper=new QueryWrapper<>();
        int aSum=0;
        int bSum=0;
        if(findUtil.getCityCode()!=null &&!findUtil.getCityCode().equals("")){
            enterpriseQueryWrapper.eq("cityCode",findUtil.getCityCode());
        }
        if(findUtil.getDistrictCode()!=null && !findUtil.getDistrictCode().equals("")){
            enterpriseQueryWrapper.eq("districtCode",findUtil.getDistrictCode());
        }
        if(findUtil.getTownCode()!=null && !findUtil.getTownCode().equals("")){
            enterpriseQueryWrapper.eq("townCode",findUtil.getTownCode());
        }
        List<Enterprise> enterprises=enterpriseService.list(enterpriseQueryWrapper);
       for(Enterprise enterprise:enterprises){
           QueryWrapper<SaleDeclarationA> saleDeclarationAQueryWrapper=new QueryWrapper<>();
           QueryWrapper<SaleDeclarationB> saleDeclarationBQueryWrapper=new QueryWrapper<>();
           if(findUtil.getBeginDate()!=null && !findUtil.getBeginDate().equals("")){
               saleDeclarationAQueryWrapper.gt("saleDate",findUtil.getBeginDate());
               saleDeclarationBQueryWrapper.gt("saleDate",findUtil.getBeginDate());
           }
           if(findUtil.getEndDate()!=null && !findUtil.getEndDate().equals("")){
               saleDeclarationAQueryWrapper.lt("saleDate",findUtil.getEndDate());
               saleDeclarationBQueryWrapper.lt("saleDate",findUtil.getEndDate());
           }
           saleDeclarationAQueryWrapper.eq("eid",enterprise.getEnterpriseId()).eq("types",1);
           saleDeclarationBQueryWrapper.eq("eid",enterprise.getEnterpriseId()).eq("types",1);
           aSum=aSum+saleDeclarationAService.count(saleDeclarationAQueryWrapper);
           bSum=bSum+saleDeclarationBService.count(saleDeclarationBQueryWrapper);
       }
        FindQuarantineUtil findQuarantineUtil=new FindQuarantineUtil();
        findQuarantineUtil.setNumberA(aSum);
        findQuarantineUtil.setNumberB(bSum);
        findQuarantineUtils.add(findQuarantineUtil);

        List<FindQuarantineUtil> o=page4(findQuarantineUtils,findUtil.getPageSize(),findUtil.getPageIndex());
        returnVO.setData(o);
        returnVO.setTotal(findQuarantineUtils.size());

        return returnVO;
    }
    //查询检疫情况(分)
    @PostMapping("/findQuarantine2")
    @ResponseBody
    @AuthToken
    public ReturnVO findQuarantine2(@RequestBody() FindUtil findUtil) throws NoSuchMethodException, SecurityException,
            IllegalAccessException, IllegalArgumentException, InvocationTargetException {
        ReturnVO returnVO=new ReturnVO();
        List<FindQuarantineUtil> findQuarantineUtils=new ArrayList<>();
        QueryWrapper<Enterprise> enterpriseQueryWrapper=new QueryWrapper<>();
        if(findUtil.getCityCode()!=null &&!findUtil.getCityCode().equals("")){
            enterpriseQueryWrapper.eq("cityCode",findUtil.getCityCode());
        }
        if(findUtil.getDistrictCode()!=null && !findUtil.getDistrictCode().equals("")){
            enterpriseQueryWrapper.eq("districtCode",findUtil.getDistrictCode());
        }
        if(findUtil.getTownCode()!=null && !findUtil.getTownCode().equals("")){
            enterpriseQueryWrapper.eq("townCode",findUtil.getTownCode());
        }
        List<Enterprise> enterprises=enterpriseService.list(enterpriseQueryWrapper);
        for(Enterprise enterprise:enterprises){
            int aSum=0;
            int bSum=0;
            QueryWrapper<SaleDeclarationA> saleDeclarationAQueryWrapper=new QueryWrapper<>();
            QueryWrapper<SaleDeclarationB> saleDeclarationBQueryWrapper=new QueryWrapper<>();
            if(findUtil.getBeginDate()!=null && !findUtil.getBeginDate().equals("")){
                saleDeclarationAQueryWrapper.gt("saleDate",findUtil.getBeginDate());
                saleDeclarationBQueryWrapper.gt("saleDate",findUtil.getBeginDate());
            }
            if(findUtil.getEndDate()!=null && !findUtil.getEndDate().equals("")){
                saleDeclarationAQueryWrapper.lt("saleDate",findUtil.getEndDate());
                saleDeclarationBQueryWrapper.lt("saleDate",findUtil.getEndDate());
            }
            saleDeclarationAQueryWrapper.eq("eid",enterprise.getEnterpriseId()).eq("types",1);
            saleDeclarationBQueryWrapper.eq("eid",enterprise.getEnterpriseId()).eq("types",1);
            aSum=saleDeclarationAService.count(saleDeclarationAQueryWrapper);
            bSum=saleDeclarationBService.count(saleDeclarationBQueryWrapper);

            FindQuarantineUtil findQuarantineUtil=new FindQuarantineUtil();
            findQuarantineUtil.seteName(enterprise.getEnterpriseName());
            findQuarantineUtil.setNumberA(aSum);
            findQuarantineUtil.setNumberB(bSum);
            findQuarantineUtils.add(findQuarantineUtil);
        }
        List<FindQuarantineUtil> o=page4(findQuarantineUtils,findUtil.getPageSize(),findUtil.getPageIndex());
        returnVO.setData(o);
        returnVO.setTotal(findQuarantineUtils.size());

        return returnVO;
    }
    //查询无害化情况
    @PostMapping("/findHarmless")
    @ResponseBody
    @AuthToken
    public ReturnVO findHarmless(@RequestBody() FindUtil findUtil) throws NoSuchMethodException, SecurityException,
            IllegalAccessException, IllegalArgumentException, InvocationTargetException {
        ReturnVO returnVO=new ReturnVO();
        List<FindHarmlessUtil> findHarmlessUtils=new ArrayList<>();
        QueryWrapper<Enterprise> enterpriseQueryWrapper=new QueryWrapper<>();
        int aSum=0;
        int bSum=0;
        int cSum=0;
        int dSum=0;
        if(findUtil.getCityCode()!=null &&!findUtil.getCityCode().equals("")){
            enterpriseQueryWrapper.eq("cityCode",findUtil.getCityCode());
        }
        if(findUtil.getDistrictCode()!=null && !findUtil.getDistrictCode().equals("")){
            enterpriseQueryWrapper.eq("districtCode",findUtil.getDistrictCode());
        }
        if(findUtil.getTownCode()!=null && !findUtil.getTownCode().equals("")){
            enterpriseQueryWrapper.eq("townCode",findUtil.getTownCode());
        }
        List<Enterprise> enterprises=enterpriseService.list(enterpriseQueryWrapper);
        System.out.println("所有满足的企业"+enterprises);
        for(Enterprise enterprise:enterprises){
            QueryWrapper<HarmlessReport> harmlessReportQueryWrapper=new QueryWrapper<>();
            if(findUtil.getBeginDate()!=null && !findUtil.getBeginDate().equals("")){
                harmlessReportQueryWrapper.gt("declareTime",findUtil.getBeginDate());
            }
            if(findUtil.getEndDate()!=null && !findUtil.getEndDate().equals("")){
                harmlessReportQueryWrapper.lt("declareTime",findUtil.getEndDate());
            }
            harmlessReportQueryWrapper.eq("eid",enterprise.getEnterpriseId()).eq("status",2);
            List<HarmlessReport> harmlessReports=harmlessReportService.list(harmlessReportQueryWrapper);
            for(HarmlessReport harmlessReport:harmlessReports){
                if(harmlessReport.getMethod()!=null && harmlessReport.getMethod()==0){
                    aSum=aSum+harmlessReport.getDead();
                }else if(harmlessReport.getMethod()!=null && harmlessReport.getMethod()==1){
                    bSum=bSum+harmlessReport.getDead();
                }else  if(harmlessReport.getMethod()!=null && harmlessReport.getMethod()==2){
                    cSum=cSum+harmlessReport.getDead();
                }else if(harmlessReport.getMethod()!=null && harmlessReport.getMethod()==3){
                    dSum=dSum+harmlessReport.getDead();
                }
            }
        }
        FindHarmlessUtil findHarmlessUtil=new FindHarmlessUtil();
        findHarmlessUtil.setFireNumber(aSum);
        findHarmlessUtil.setBuryNumber(bSum);
        findHarmlessUtil.setChemicalNumber(cSum);
        findHarmlessUtil.setHarmlessNumber(dSum);
        findHarmlessUtils.add(findHarmlessUtil);
        System.out.println("统计结果"+findHarmlessUtils+"焚烧"+aSum);

        List<FindHarmlessUtil> o=page5(findHarmlessUtils,findUtil.getPageSize(),findUtil.getPageIndex());
        returnVO.setData(o);
        returnVO.setTotal(findHarmlessUtils.size());

        return returnVO;
    }
    //查询无害化情况
    @PostMapping("/findHarmless2")
    @ResponseBody
    @AuthToken
    public ReturnVO findHarmless2(@RequestBody() FindUtil findUtil) throws NoSuchMethodException, SecurityException,
            IllegalAccessException, IllegalArgumentException, InvocationTargetException {
        ReturnVO returnVO=new ReturnVO();
        List<FindHarmlessUtil> findHarmlessUtils=new ArrayList<>();
        QueryWrapper<Enterprise> enterpriseQueryWrapper=new QueryWrapper<>();

        if(findUtil.getCityCode()!=null &&!findUtil.getCityCode().equals("")){
            enterpriseQueryWrapper.eq("cityCode",findUtil.getCityCode());
        }
        if(findUtil.getDistrictCode()!=null && !findUtil.getDistrictCode().equals("")){
            enterpriseQueryWrapper.eq("districtCode",findUtil.getDistrictCode());
        }
        if(findUtil.getTownCode()!=null && !findUtil.getTownCode().equals("")){
            enterpriseQueryWrapper.eq("townCode",findUtil.getTownCode());
        }
        List<Enterprise> enterprises=enterpriseService.list(enterpriseQueryWrapper);
        System.out.println("所有满足的企业"+enterprises);
        for(Enterprise enterprise:enterprises){
            int aSum=0;
            int bSum=0;
            int cSum=0;
            int dSum=0;
            QueryWrapper<HarmlessReport> harmlessReportQueryWrapper=new QueryWrapper<>();
            if(findUtil.getBeginDate()!=null && !findUtil.getBeginDate().equals("")){
                harmlessReportQueryWrapper.gt("declareTime",findUtil.getBeginDate());
            }
            if(findUtil.getEndDate()!=null && !findUtil.getEndDate().equals("")){
                harmlessReportQueryWrapper.lt("declareTime",findUtil.getEndDate());
            }
            harmlessReportQueryWrapper.eq("eid",enterprise.getEnterpriseId()).eq("status",2);
            List<HarmlessReport> harmlessReports=harmlessReportService.list(harmlessReportQueryWrapper);
            for(HarmlessReport harmlessReport:harmlessReports){
                if(harmlessReport.getMethod()!=null && harmlessReport.getMethod()==0){
                    aSum=aSum+harmlessReport.getDead();
                }else if(harmlessReport.getMethod()!=null && harmlessReport.getMethod()==1){
                    bSum=bSum+harmlessReport.getDead();
                }else  if(harmlessReport.getMethod()!=null && harmlessReport.getMethod()==2){
                    cSum=cSum+harmlessReport.getDead();
                }else if(harmlessReport.getMethod()!=null && harmlessReport.getMethod()==3){
                    dSum=dSum+harmlessReport.getDead();
                }
            }
            FindHarmlessUtil findHarmlessUtil=new FindHarmlessUtil();
            findHarmlessUtil.seteName(enterprise.getEnterpriseName());
            findHarmlessUtil.setFireNumber(aSum);
            findHarmlessUtil.setBuryNumber(bSum);
            findHarmlessUtil.setChemicalNumber(cSum);
            findHarmlessUtil.setHarmlessNumber(dSum);
            findHarmlessUtils.add(findHarmlessUtil);
        }

        List<FindHarmlessUtil> o=page5(findHarmlessUtils,findUtil.getPageSize(),findUtil.getPageIndex());
        returnVO.setData(o);
        returnVO.setTotal(findHarmlessUtils.size());

        return returnVO;
    }
    /**
     * 循环截取某页列表进行分页
     * @param dataList 分页数据
     * @param pageSize  页面大小
     * @param currentPage   当前页面
     */
    public static List<FindEnterpriseUtil> page1(List<FindEnterpriseUtil> dataList, int pageSize,int currentPage) {
        List<FindEnterpriseUtil> currentPageList = new ArrayList<>();
        if (dataList != null && dataList.size() > 0) {
            int currIdx = (currentPage > 1 ? (currentPage - 1) * pageSize : 0);
            for (int i = 0; i < pageSize && i < dataList.size() - currIdx; i++) {
                FindEnterpriseUtil data = dataList.get(currIdx + i);
                currentPageList.add(data);
            }
        }
        return currentPageList;
    }
    /**
     * 循环截取某页列表进行分页
     * @param dataList 分页数据
     * @param pageSize  页面大小
     * @param currentPage   当前页面
     */
    public static List<FindLivestockUtil> page2(List<FindLivestockUtil> dataList, int pageSize,int currentPage) {
        List<FindLivestockUtil> currentPageList = new ArrayList<>();
        if (dataList != null && dataList.size() > 0) {
            int currIdx = (currentPage > 1 ? (currentPage - 1) * pageSize : 0);
            for (int i = 0; i < pageSize && i < dataList.size() - currIdx; i++) {
                FindLivestockUtil data = dataList.get(currIdx + i);
                currentPageList.add(data);
            }
        }
        return currentPageList;
    }
    /**
     * 循环截取某页列表进行分页
     * @param dataList 分页数据
     * @param pageSize  页面大小
     * @param currentPage   当前页面
     */
    public static List<FindPoultryUtil> page3(List<FindPoultryUtil> dataList, int pageSize,int currentPage) {
        List<FindPoultryUtil> currentPageList = new ArrayList<>();
        if (dataList != null && dataList.size() > 0) {
            int currIdx = (currentPage > 1 ? (currentPage - 1) * pageSize : 0);
            for (int i = 0; i < pageSize && i < dataList.size() - currIdx; i++) {
                FindPoultryUtil data = dataList.get(currIdx + i);
                currentPageList.add(data);
            }
        }
        return currentPageList;
    }
    /**
     * 循环截取某页列表进行分页
     * @param dataList 分页数据
     * @param pageSize  页面大小
     * @param currentPage   当前页面
     */
    public static List<FindQuarantineUtil> page4(List<FindQuarantineUtil> dataList, int pageSize,int currentPage) {
        List<FindQuarantineUtil> currentPageList = new ArrayList<>();
        if (dataList != null && dataList.size() > 0) {
            int currIdx = (currentPage > 1 ? (currentPage - 1) * pageSize : 0);
            for (int i = 0; i < pageSize && i < dataList.size() - currIdx; i++) {
                FindQuarantineUtil data = dataList.get(currIdx + i);
                currentPageList.add(data);
            }
        }
        return currentPageList;
    }
    /**
     * 循环截取某页列表进行分页
     * @param dataList 分页数据
     * @param pageSize  页面大小
     * @param currentPage   当前页面
     */
    public static List<FindHarmlessUtil> page5(List<FindHarmlessUtil> dataList, int pageSize,int currentPage) {
        List<FindHarmlessUtil> currentPageList = new ArrayList<>();
        if (dataList != null && dataList.size() > 0) {
            int currIdx = (currentPage > 1 ? (currentPage - 1) * pageSize : 0);
            for (int i = 0; i < pageSize && i < dataList.size() - currIdx; i++) {
                FindHarmlessUtil data = dataList.get(currIdx + i);
                currentPageList.add(data);
            }
        }
        return currentPageList;
    }
//    @GetMapping("/entDistribution")
//    @ResponseBody
//    public ReturnVO distribution(Integer eType,Integer city,Integer district,Integer town) {
//        ReturnVO returnVO = new ReturnVO();
//        returnVO.setCode("200");
//        if(town== null ||town.intValue() == 0){
//            returnVO.setData(statMapper.entDistributionByDistrict(eType,district));
//        }else{
//            returnVO.setData(statMapper.entDistributionByTown(eType,town));
//        }
//        return returnVO;
//    }
//
//    @GetMapping("/animal")
//    @ResponseBody
//    public ReturnVO animal(Integer city,Integer district,Integer town) {
//        ReturnVO returnVO = new ReturnVO();
//        returnVO.setCode("200");
//        if(town== null ||town.intValue() == 0){
//            returnVO.setData(statMapper.animalNumByDistrict(district));
//        }else{
//            returnVO.setData(statMapper.animalNumByTown(town));
//        }
//        return returnVO;
//    }
//
//    @GetMapping("/stock")
//    @ResponseBody
//    public ReturnVO stock(Integer type,Integer city,Integer district,Integer town) {
//        ReturnVO returnVO = new ReturnVO();
//        returnVO.setCode("200");
//        List<Map<String,Object>> resultData = new ArrayList<>();
//        List<String> animalList = new ArrayList<>();
//        if(type==1){
//            animalList.add("猪");
//            animalList.add("牛");
//            animalList.add("羊");
//        }else{
//            animalList.add("肉鸡");
//            animalList.add("肉鸭");
//            animalList.add("蛋鸡");
//            animalList.add("蛋鸭");
//            animalList.add("其他");
//        }
//        List<String> timeList = new ArrayList<>();
//        Calendar calendar = Calendar.getInstance();
//        for(int i= 12;i>0;i--){
//            calendar.setTime(new Date());
//            calendar.add(Calendar.MONTH, -i);
//            calendar.set(Calendar.DAY_OF_MONTH, 1);
//            timeList.add( new SimpleDateFormat("yyyy-MM-dd").format(calendar.getTime()));
//        }
//        calendar.setTime(new Date());
//        calendar.add(Calendar.MONTH, -13);
//        calendar.set(Calendar.DAY_OF_MONTH, 1);
//        String startDate = new SimpleDateFormat("yyyy-MM-dd").format(calendar.getTime());
//        List<Map<String,Object>> data = null;
//        try{
//            if(town== null ||town.intValue() == 0){
//                data = statMapper.stockByDistrict(district,startDate,animalList);
//            }else{
//                data =  statMapper.stockByTown(town,startDate,animalList);
//            }
//        }catch (Exception ex){
//            ex.printStackTrace();
//        }
//
//        Map<String,Object> tempMap = new HashMap<>();
//        for(Map<String,Object> map :data){
//            tempMap.put(String.valueOf(map.get("time"))+ map.get("type"),map.get("cnt"));
//        }
//        for(String time:timeList){
//            Map<String,Object> map = new HashMap<>();
//            map.put("time",time.substring(0,7));
//            for (String animal:animalList) {
//                if(tempMap.containsKey(time+animal)){
//                    map.put(animal,tempMap.get(time+animal));
//                }else{
//                    map.put(animal,0);
//                }
//            }
//            resultData.add(map);
//        }
//        returnVO.setData(resultData);
//        return returnVO;
//    }
//
//    @GetMapping("/quarantine")
//    @ResponseBody
//    public ReturnVO quarantine(Integer city,Integer district,Integer town) {
//        ReturnVO returnVO = new ReturnVO();
//        returnVO.setCode("200");
//        List<Map<String,Object>> resultData = new ArrayList<>();
//        List<String> timeList = new ArrayList<>();
//        Calendar calendar = Calendar.getInstance();
//        for(int i= 11;i>=0;i--){
//            calendar.setTime(new Date());
//            calendar.add(Calendar.MONTH, -i);
//            calendar.set(Calendar.DAY_OF_MONTH, 1);
//            timeList.add( new SimpleDateFormat("yyyy-MM-dd").format(calendar.getTime()).substring(0,7));
//        }
//        calendar.setTime(new Date());
//        calendar.add(Calendar.MONTH, -11);
//        calendar.set(Calendar.DAY_OF_MONTH, 1);
//        String startDate = new SimpleDateFormat("yyyy-MM-dd").format(calendar.getTime());
//        List<Map<String,Object>> data = null;
//        try{
//            if(town== null ||town.intValue() == 0){
//                data = statMapper.quarantineByDistrict(district,startDate);
//            }else{
//                data =  statMapper.quarantineByTown(town,startDate);
//            }
//        }catch (Exception ex){
//            ex.printStackTrace();
//        }
//        Map<String,Object> tempMap = new HashMap<>();
//        for(Map<String,Object> map :data){
//            tempMap.put(String.valueOf(map.get("time")),map.get("cnt"));
//        }
//        for(String time:timeList){
//            Map<String,Object> map = new HashMap<>();
//            map.put("time",time);
//            if(tempMap.containsKey(time)){
//                map.put("cnt",tempMap.get(time));
//            }else{
//                map.put("cnt",0);
//            }
//            resultData.add(map);
//        }
//        returnVO.setData(resultData);
//        return returnVO;
//    }
//
//
//    @GetMapping("/dead")
//    @ResponseBody
//    public ReturnVO dead(Integer city,Integer district,Integer town) {
//        ReturnVO returnVO = new ReturnVO();
//        returnVO.setCode("200");
//        List<Map<String,Object>> resultData = new ArrayList<>();
//        List<String> timeList = new ArrayList<>();
//        Calendar calendar = Calendar.getInstance();
//        for(int i= 11;i>=0;i--){
//            calendar.setTime(new Date());
//            calendar.add(Calendar.MONTH, -i);
//            calendar.set(Calendar.DAY_OF_MONTH, 1);
//            timeList.add( new SimpleDateFormat("yyyy-MM-dd").format(calendar.getTime()).substring(0,7));
//        }
//        calendar.setTime(new Date());
//        calendar.add(Calendar.MONTH, -11);
//        calendar.set(Calendar.DAY_OF_MONTH, 1);
//        String startDate = new SimpleDateFormat("yyyy-MM-dd").format(calendar.getTime());
//        List<Map<String,Object>> data = null;
//        try{
//            if(town== null ||town.intValue() == 0){
//                data = statMapper.deadByDistrict(district,startDate);
//            }else{
//                data =  statMapper.deadByTown(town,startDate);
//            }
//        }catch (Exception ex){
//            ex.printStackTrace();
//        }
//        Map<String,Object> tempMap = new HashMap<>();
//        for(Map<String,Object> map :data){
//            tempMap.put(String.valueOf(map.get("time")),map.get("cnt"));
//        }
//        for(String time:timeList){
//            Map<String,Object> map = new HashMap<>();
//            map.put("time",time);
//            if(tempMap.containsKey(time)){
//                map.put("cnt",tempMap.get(time));
//            }else{
//                map.put("cnt",0);
//            }
//            resultData.add(map);
//        }
//        returnVO.setData(resultData);
//        return returnVO;
//    }
//
//    @GetMapping("/slaughter")
//    @ResponseBody
//    public ReturnVO slaughter(Integer city,Integer district,Integer town) {
//        ReturnVO returnVO = new ReturnVO();
//        returnVO.setCode("200");
//        List<Map<String,Object>> resultData = new ArrayList<>();
//        List<String> timeList = new ArrayList<>();
//        Calendar calendar = Calendar.getInstance();
//        for(int i= 14;i>=0;i--){
//            calendar.setTime(new Date());
//            calendar.add(Calendar.DAY_OF_MONTH, -i);
//            timeList.add( new SimpleDateFormat("yyyy-MM-dd").format(calendar.getTime()));
//        }
//        calendar.setTime(new Date());
//        calendar.add(Calendar.DAY_OF_MONTH, -14);
//        String startDate = new SimpleDateFormat("yyyy-MM-dd").format(calendar.getTime());
//        List<Map<String,Object>> data = null;
//        try{
//            if(town== null ||town.intValue() == 0){
//                data = statMapper.slaughterByDistrict(district,startDate);
//            }else{
//                data =  statMapper.slaughterByTown(town,startDate);
//            }
//        }catch (Exception ex){
//            ex.printStackTrace();
//        }
//        Map<String,Object> tempMap = new HashMap<>();
//        for(Map<String,Object> map :data){
//            tempMap.put(String.valueOf(map.get("time")),map.get("cnt"));
//        }
//        for(String time:timeList){
//            Map<String,Object> map = new HashMap<>();
//            map.put("time",time);
//            if(tempMap.containsKey(time)){
//                map.put("cnt",tempMap.get(time));
//            }else{
//                map.put("cnt",0);
//            }
//            resultData.add(map);
//        }
//        returnVO.setData(resultData);
//        return returnVO;
//    }
//
//    @GetMapping("/production")
//    @ResponseBody
//    public ReturnVO production(String animalType,Integer city,Integer district,Integer town) {
//        ReturnVO returnVO = new ReturnVO();
//        returnVO.setCode("200");
//        List<String> typeList = new ArrayList<>();
//        typeList.add("调入");
//        typeList.add("调出");
//        typeList.add("出生");
//        typeList.add("死淘");
//        List<Map<String,Object>> resultData = new ArrayList<>();
//        List<String> timeList = new ArrayList<>();
//        Calendar calendar = Calendar.getInstance();
//        for(int i= 5;i>=0;i--){
//            calendar.setTime(new Date());
//            calendar.add(Calendar.MONTH, -i);
//            calendar.set(Calendar.DAY_OF_MONTH, 1);
//            timeList.add( new SimpleDateFormat("yyyy-MM-dd").format(calendar.getTime()));
//        }
//        calendar.setTime(new Date());
//        calendar.add(Calendar.MONTH, -5);
//        calendar.set(Calendar.DAY_OF_MONTH, 1);
//        String startDate = new SimpleDateFormat("yyyy-MM-dd").format(calendar.getTime());
//        List<Map<String,Object>> data = null;
//        try{
//            if(town== null ||town.intValue() == 0){
//                data = statMapper.productionByDistrict(animalType,district,startDate);
//            }else{
//                data =  statMapper.productionByTown(animalType,town,startDate);
//            }
//        }catch (Exception ex){
//            ex.printStackTrace();
//        }
//
//        Map<String,Object> tempMap = new HashMap<>();
//        for(Map<String,Object> map :data){
//            tempMap.put(String.valueOf(map.get("time"))+ map.get("type"),map.get("cnt"));
//        }
//        for(String time:timeList){
//            Map<String,Object> map = new HashMap<>();
//            map.put("time",time.substring(0,7));
//            for (String type:typeList) {
//                if(tempMap.containsKey(time+type)){
//                    map.put(type,tempMap.get(time+type));
//                }else{
//                    map.put(type,0);
//                }
//            }
//            resultData.add(map);
//        }
//        returnVO.setData(resultData);
//        return returnVO;
//    }
//
//    @GetMapping("/harmless")
//    @ResponseBody
//    public ReturnVO harmless(String animalType,Integer city,Integer district,Integer town) {
//        ReturnVO returnVO = new ReturnVO();
//        returnVO.setCode("200");
//        Calendar calendar = Calendar.getInstance();
//        calendar.setTime(new Date());
//        calendar.add(Calendar.MONTH, 0);
//        String startDate = new SimpleDateFormat("yyyy-MM").format(calendar.getTime());
//        if(town== null ||town.intValue() == 0){
//            returnVO.setData(statMapper.harmlessByDistrict(animalType,district,startDate));
//        }else{
//            returnVO.setData(statMapper.harmlessByTown(animalType,town,startDate));
//        }
//        return returnVO;
//    }
//
//    @GetMapping("/quarantineBar")
//    @ResponseBody
//    public ReturnVO quarantineBar(String animalType,Integer city,Integer district,Integer town) {
//        ReturnVO returnVO = new ReturnVO();
//        returnVO.setCode("200");
//        Calendar calendar = Calendar.getInstance();
//        calendar.setTime(new Date());
//        calendar.add(Calendar.MONTH, 0);
//        String startDate = new SimpleDateFormat("yyyy-MM").format(calendar.getTime());
//        if(town== null ||town.intValue() == 0){
//            returnVO.setData(statMapper.quarantineBarByDistrict(animalType,district,startDate));
//        }else{
//            returnVO.setData(statMapper.quarantineBarByTown(animalType,town,startDate));
//        }
//        return returnVO;
//    }

}
